<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of UserForm
 *
 * @author Admin
 */
class Application_Form_users_UserForm extends Zend_Form {

    public function __construct($options = null) {
        parent::__construct($options);

        $firstName = new Zend_Form_Element_Text('firstName');
        $firstName->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $lastName = new Zend_Form_Element_Text('lastName');
        $lastName->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $email = new Zend_Form_Element_Text('email');
        $email->addFilter('StripTags')
                ->addValidator('EmailAddress')
                ->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $phone = new Zend_Form_Element_Text('phone');
        $phone->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $cell = new Zend_Form_Element_Text('cell');
        $cell->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $password = new Zend_Form_Element_Password('password');
        $password->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('StringLength', false, array(6, 20))
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
        //        ->addPrefixPath('Crm_Validate', '../application/forms/validate', 'Validate')
         //       ->addValidator('PasswordConfirmation', false, array('confirmPassword'))
                ->setDecorators(array('ViewHelper', 'Errors'));

        $confirmPassword = new Zend_Form_Element_Password('confirmPassword');
        $confirmPassword->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->setRequired(true)
                ->setAttrib('class', 'text ui-corner-all')
                ->addValidator('StringLength', false, array(6, 20))
     //           ->addPrefixPath('Crm_Validate', '../application/forms/validate', 'Validate')
      //          ->addValidator('PasswordConfirmation', false, array('password'))
                ->setDecorators(array('ViewHelper', 'Errors'));

        $role = new Zend_Form_Element_Select('role');
        $role->addMultiOption('superadmin', ' Super Admin ')
                ->addMultiOption('admin', ' Admin ')
                ->addMultiOption('user', ' User ')                
                ->setSeparator("")
                ->setAttrib('class', 'select ui-corner-all')
                ->setAttrib('onchange', 'updateForm(this.value)')
                ->setDecorators(array('ViewHelper', 'Errors'));

        $department = new Zend_Form_Element_Select('department');
        $department->addMultiOption('planning', ' Planning ')
                ->addMultiOption('marketing', ' Marketing ')
                ->addMultiOption('streetDigging', ' Street Digging ')
                ->addMultiOption('houseDigging', ' House Digging ')
                ->addMultiOption('installation', ' Instalation ')
                ->addMultiOption('economy', ' Economy ')                
                ->setSeparator("")
                ->setAttrib('class', 'select ui-corner-all')
                ->setAttrib('disabled', true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $status = new Zend_Form_Element_Select('status');
        $status->addMultiOption('active', ' Active')
                ->addMultiOption('inactive', ' Inactive')
                ->setSeparator("")
                ->setValue('active')
                ->setAttrib('class', 'select ui-corner-all')
                ->setDecorators(array('ViewHelper', 'Errors'));


        $this->addElements(array($firstName, $lastName, $email, $phone, $cell, $password, $confirmPassword, $role, $department, $status));
    }

}